﻿//using NUnit.Framework;
//using TextCompiler.Expressions;
//using TextCompiler.Expressions.Terminals.Parsing;

//namespace TextCompiler.Tests.Tokens.Parsing.Symbol
//{
//    [TestFixture]
//    public class ParseFilterSymbolTerminalTests
//    {
//        [Test]
//        public void Parse_WhenParsingInvalidStringButNoMinimum_ShouldReturnEmptyString()
//        {
//            ParseFilterSymbolTerminal token = new ParseFilterSymbolTerminal(IsAlpha, IsMinuscule, null, null);
//            ParsingResult<string> result = token.Parse("1234567890");

//            string expected = "";
//            string actual = result.Value;

//            Assert.AreEqual(expected, actual);
//            Assert.AreEqual(0, result.Length);
//        }

//        [Test]
//        public void Parse_WhenParsingInvalidStringButMinimumOfOne_ShouldReturnNull()
//        {
//            ParseFilterSymbolTerminal token = new ParseFilterSymbolTerminal(IsAlpha, IsMinuscule, 1, null);

//            var expected = (ParsingResult<string>)null;
//            var actual = token.Parse("1234567890");

//            Assert.AreEqual(expected, actual);
//        }

//        [Test]
//        public void Parse_WhenParsingLongWordWithALimitOfFive_ShouldReturnFirstFiveCharacters()
//        {
//            ParseFilterSymbolTerminal token = new ParseFilterSymbolTerminal(IsAlpha, IsMinuscule, null, 5);
//            ParsingResult<string> result = token.Parse("Someverylongword");

//            string expected = "Somev";
//            string actual = result.Value;

//            Assert.AreEqual(expected, actual);
//            Assert.AreEqual(expected.Length, result.Length);
//        }

//        [Test]
//        public void Parse_WhenParsingValidFirstCharacterButNotOtherCharacter_ShouldOnlyReturnFirstCharacter()
//        {
//            ParseFilterSymbolTerminal token = new ParseFilterSymbolTerminal(IsAlpha, IsMajuscule, null, null);
//            ParsingResult<string> result = token.Parse("Someverylongword");

//            string expected = "S";
//            string actual = result.Value;

//            Assert.AreEqual(expected, actual);
//            Assert.AreEqual(expected.Length, result.Length);
//        }

//        [Test]
//        public void ParseNode_WhenParsingInvalidStringButNoMinimum_ShouldReturnEmptyString()
//        {
//            ParseFilterSymbolTerminal token = new ParseFilterSymbolTerminal(IsAlpha, IsMinuscule, null, null);
//            ParsingNodeResult node = token.ParseNode("1234567890");

//            string expected = "";
//            string actual = node.Value as string;

//            Assert.AreEqual(expected, actual);
//            Assert.AreEqual(0, node.Length);
//            Assert.AreEqual(1, node.ExploredLength);
//        }

//        [Test]
//        public void ParseNode_WhenParsingInvalidStringButMinimumOfOne_ShouldReturnNull()
//        {
//            ParseFilterSymbolTerminal token = new ParseFilterSymbolTerminal(IsAlpha, IsMinuscule, 1, null);
//            ParsingNodeResult node = token.ParseNode("1234567890");

//            string expected = null;
//            string actual = node.Value as string;

//            Assert.AreEqual(expected, actual);
//            Assert.AreEqual(0, node.Length);
//            Assert.AreEqual(1, node.ExploredLength);
//        }

//        [Test]
//        public void ParseNode_WhenParsingLongWordWithALimitOfFive_ShouldReturnFirstFiveCharacters()
//        {
//            ParseFilterSymbolTerminal token = new ParseFilterSymbolTerminal(IsAlpha, IsMinuscule, null, 5);
//            ParsingNodeResult node = token.ParseNode("Someverylongword");

//            string expected = "Somev";
//            string actual = node.Value as string;

//            Assert.AreEqual(expected, actual);
//            Assert.AreEqual(5, node.Length);
//            Assert.AreEqual(5, node.ExploredLength);
//        }

//        [Test]
//        public void ParseNode_WhenParsingValidFirstCharacterButNotOtherCharacter_ShouldOnlyReturnFirstCharacter()
//        {
//            ParseFilterSymbolTerminal token = new ParseFilterSymbolTerminal(IsAlpha, IsMajuscule, null, null);
//            ParsingNodeResult node = token.ParseNode("Someverylongword");

//            string expected = "S";
//            string actual = node.Value as string;

//            Assert.AreEqual(expected, actual);
//            Assert.AreEqual(1, node.Length);
//            Assert.AreEqual(2, node.ExploredLength);
//        }

//        #region Private methods

//        private static bool IsAlphaNumeric(char chr)
//        {
//            return IsAlpha(chr) || IsNumber(chr);
//        }

//        private static bool IsAlpha(char chr)
//        {
//            return IsMinuscule(chr) || IsMajuscule(chr);
//        }

//        private static bool IsMinuscule(char chr)
//        {
//            return chr >= 'a' && chr <= 'z';
//        }

//        private static bool IsMajuscule(char chr)
//        {
//            return chr >= 'A' && chr <= 'Z';
//        }

//        private static bool IsNumber(char chr)
//        {
//            return chr >= '0' && chr <= '9';
//        }

//        #endregion Private methods
//    }
//}